Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: Remove redundant pattern for matching build directories #1508

Merged
merged 1 commit into from
May 14, 2015
Merged

Android: Remove redundant pattern for matching build directories #1508

merged 1 commit into from
May 14, 2015

Conversation

baudm
Copy link

@baudm baudm commented May 7, 2015

build/ already matches all directories named 'build' in the repository,
regardless of level. Gradle can have more than two levels of project nesting.
However, /*/build/ matches only the 'build' directories of 2nd-level projects.
Thus, the first pattern is more appropriate than the second.

build/ already matches all directories named 'build' in the repository,
regardless of level. Gradle can have more than two levels of project nesting.
However, /*/build/ matches only the 'build' directories of 2nd-level projects.
Thus, the first pattern is more appropriate than the second.
@arcresu
Copy link
Contributor

arcresu commented May 8, 2015

Thanks, but are you sure about that? I haven't checked, but I seem to recall that if there is a slash anywhere in the pattern, git starts anchoring it to the top of the project. It would be nice to double check this first.

@baudm
Copy link
Author

baudm commented May 8, 2015

Yes I'm sure. /build would match a file or directory at the root, while
build/ would match a directory at any level. //build/ would match a
directory at the second level while /
*/build/ would match a directory at
any level, which is essentially the same as build/.

@baudm
Copy link
Author

baudm commented May 8, 2015

Pertinent excerpts from the gitignore manpage:

If the pattern ends with a slash, it is removed for the purpose of the following description, but it would only find a match with a directory. In other words, foo/ will match a directory foo and paths underneath it, but will not match a regular file or a symbolic link foo (this is consistent with the way how pathspec works in general in Git).

...

A leading slash matches the beginning of the pathname. For example, "/*.c" matches "cat-file.c" but not "mozilla-sha1/sha1.c".

If you're still in doubt, you could check it yourself. :)

@baudm
Copy link
Author

baudm commented May 11, 2015

@arcresu any updates on this? I've already quoted the pertinent excerpts from the gitignore manpage; all info needed is there. And as I said before, this is really easy to test. Just create a new Git repo, add a bunch of "build" directories on different levels, and observe how each pattern works.

@arcresu
Copy link
Contributor

arcresu commented May 14, 2015

Sorry for the delay - I haven't had much time to process PRs here lately. Yes, you're right about this rule. Thanks for confirming, I just couldn't quite remember how it worked. 🎉

arcresu added a commit that referenced this pull request May 14, 2015
Android: Remove redundant pattern for matching build directories
@arcresu arcresu merged commit d6c7caa into github:master May 14, 2015
@arcresu arcresu mentioned this pull request May 14, 2015
u9E9F pushed a commit to u9E9F/gitignore that referenced this pull request Jul 8, 2017
Android: Remove redundant pattern for matching build directories
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants